#include "block.h"

Block::Block() : FixedUnit()
{
    init();
}

Block::Block(QRect &geometry) : FixedUnit(geometry)
{
    init();
}


int Block::getType() const {return Unit::Block;}


void Block::init()
{
    m_sprite = "block1";
    loadPixmaps();
    this->setLives(1);
}


void Block::draw(QPainter *painter)
{
    /*
    painter->fillRect(this->m_geometry, Qt::darkRed);
    painter->setPen(Qt::white);
    painter->drawText(m_geometry.center().x(), m_geometry.center().y(), "B");
    */
    painter->drawPixmap(this->m_geometry, this->m_pixmaps[0][0]);
}

void Block::dig()
{
    this->loseALife();
}


void Block::serializeDebug(QDebug &dbg)
{
    dbg << "Block : ";
    FixedUnit::serializeDebug(dbg);
}

void Block::serializeIn(QDataStream &in)
{
    FixedUnit::serializeIn(in);
    init();
}

void Block::serializeOut(QDataStream &out)
{
    FixedUnit::serializeOut(out);
}
